import request from '@/config/axios'

// 订单 VO
export interface OrderVO {
  id: number // 主键id
  userId: number // 用户id
  orderSn: string // 订单编号
  orderStatus: number // 订单状态
  message: string // 用户订单留言
  goodsPrice: number // 商品总费用
  beginTime: Date // 开始时间
  endTime: Date // 结束时间
}

// 订单 API
export const OrderApi = {
  // 查询订单分页
  getOrderPage: async (params: any) => {
    return await request.get({ url: `/member/order/page`, params })
  },

  // 查询订单详情
  getOrder: async (id: number) => {
    return await request.get({ url: `/member/order/get?id=` + id })
  },

  // 新增订单
  createOrder: async (data: OrderVO) => {
    return await request.post({ url: `/member/order/create`, data })
  },

  // 修改订单
  updateOrder: async (data: OrderVO) => {
    return await request.put({ url: `/member/order/update`, data })
  },

  // 删除订单
  deleteOrder: async (id: number) => {
    return await request.delete({ url: `/member/order/delete?id=` + id })
  },

  // 导出订单 Excel
  exportOrder: async (params) => {
    return await request.download({ url: `/member/order/export-excel`, params })
  }
}